<%-- 
    Document   : Authorization
    Created on : 24.05.2010, 23:31:47
    Author     : Morfant
--%>

<%@page import="stud.cp.core.plugins.PluginConst"%>
<%@page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" language="java"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <%@include file="/header.jsp" %>
    <body>
        <div class="page">
            <div id="header">
                <div id="title">
                    <h1>Кафешка</h1>
                </div>
                <br/><br/><br/><br/><br/><br/>
            </div>
            <div id="main"> 
                <h2>Авторизация</h2>

                <form action="<%=response.encodeURL("authorization-action.do")
                        + "?"
                        + PluginConst.SUBACTION
                              + "="
                              + PluginConst.LOGIN%>"
                      method="post"
                      name="<%= PluginConst.FORM_NAME%>">
                    <fieldset>
                        <p>
                            <span class="highlight-delete-item">
                                <label for="<%=PluginConst.USER_NAME%>">Имя</label>
                            </span>
                            <input type="text"
                                   name="<%=PluginConst.USER_NAME%>"
                                   value="<%=(request.getAttribute(PluginConst.USER_NAME) == null)
                                           ? "" : request.getAttribute(PluginConst.USER_NAME)%>"/>
                        </p>
                        <p>
                            <span class="highlight-delete-item">
                                <label for="<%=PluginConst.USER_PASSWORD%>">Пароль</label>
                            </span>
                            <input type="password"
                                   name="<%=PluginConst.USER_PASSWORD%>"
                                   value="" />
                        </p>

                    </fieldset>
                    <input name="confirmButton" type="submit" value="Войти" />
                </form>
                <script  type="text/javascript">
                    var frmvalidator = new Validator("<%=PluginConst.FORM_NAME%>");
                    frmvalidator.EnableMsgsTogether();
                    frmvalidator.
                        addValidation("<%=PluginConst.USER_NAME%>",
                    "req","Имя пользователя не может быть пустым!");
                    frmvalidator.
                        addValidation("<%=PluginConst.USER_NAME%>",
                    "maxlen=70","Слишком длинное имя!");
                    frmvalidator.
                        addValidation("<%=PluginConst.USER_PASSWORD%>",
                    "req","Пароль не может быть пустым!");
                    frmvalidator.
                        addValidation("<%=PluginConst.USER_PASSWORD%>",
                    "maxlen=70","Слишком много символов!");
                </script>
                <%String temp = (String) request.getAttribute(PluginConst.ERROR_MESSAGE);
                    if (temp != null) {%>
                <p>
                    <span class="error">
                        <%=temp%>
                    </span>
                </p>
                <%}%>

            </div>
        </div>
    </body>
</html>